<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SQL</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

</head>
<body>

<div id="wrapper">

<h2>SQL</h2>
<div id="sql">
    <form action="/" method="post" id="sql">
        <textarea id="id_sql" name="sql" cols="60" rows="7"></textarea><br />
        <input type="submit" value="query" />
    </form>

</div>
</div><!-- wrapper -->

<div id="queries">
<h3>QUERIES</h3>
<div id = testcase>
	<p>query 1: select * from Customer</p>
	<p>query 2: select publisher.name  from Publisher</p>
	<p>query 3: select Book.title  from Book  where copies > 5000</p>
	<p>query 4: select  customer_id, quantity  from Orders  where quantity < 8 </p>
	<pre>query 5: select Book.title,Book.copies, Publisher.name, Publisher.nation 
					from	Book,Publisher
					where	Book.publisher_id=Publisher.id and 
							Publisher.nation='USA' and 
							Book.copies > 1000</pre>
	<pre>query 6:  select	Customer.name,Orders.quantity
					from	Customer,Orders
					where	Customer.id=Orders.customer_id</pre>
	<pre>query 7:  select	Customer.name ,Orders.quantity,Book.title
					from 		Customer,Orders,Book
					where 		Customer.id=Orders.customer_id and 
								Book.id=Orders.book_id and 
								Customer.rank=1 and
								Book.copies>5000</pre>
</div>
</div><!-- queries -->

<div id="dbinfo">
<h3>DB INFO</h3>
<h5>ddb0 tables</h5>
<table border="1">
<tr>
	<td>TABLE NAME</td>
	<td>TABLE CONTENTS</td>
</tr>
<tr>
	<td>book</td>
	<td>(id,title,authors,publisher_id,copies)</td>
</tr>
<tr>
	<td> customer </td>
	<td>(id,name)</td>
</tr>
<tr>
	<td>orders </td>
	<td> (customer_id,book_id,quantity) </td>
</tr>
<tr>
	<td>publisher </td>
	<td>(id,name,nation)</td>
</tr>
</table>
<h5>ddb1 tables</h5>
<table border="1">
<tr>
	<td>TABLE NAME</td>
	<td>TABLE CONTENTS</td>
</tr>
<tr>
	<td>book</td>
	<td>(id,title,authors,publisher_id,copies)</td>
</tr>
<tr>
	<td> customer </td>
	<td>(id,rank)</td>
</tr>
<tr>
	<td>orders </td>
	<td> (customer_id,book_id,quantity) </td>
</tr>
<tr>
	<td>publisher </td>
	<td>(id,name,nation)</td>
</tr>
</table>
<h5>ddb2 tables</h5>
<table border="1">
<tr>
	<td>TABLE NAME</td>
	<td>TABLE CONTENTS</td>
</tr>
<tr>
	<td>book</td>
	<td>(id,title,authors,publisher_id,copies)</td>
</tr>
<tr>
	<td>orders </td>
	<td> (customer_id,book_id,quantity) </td>
</tr>
<tr>
	<td>publisher </td>
	<td>(id,name,nation)</td>
</tr>
</table>
<h5>ddb3 tables</h5>
<table border="1">
<tr>
	<td>TABLE NAME</td>
	<td>TABLE CONTENTS</td>
</tr>
<tr>
	<td>book</td>
	<td>(id,title,authors,publisher_id,copies)</td>
</tr>
<tr>
	<td>orders </td>
	<td> (customer_id,book_id,quantity) </td>
</tr>
<tr>
	<td>publisher </td>
	<td>(id,name,nation)</td>
</tr>
</table>
</div>


<div id="footer">
    <span class="fright">SQL query engine</span>
</div>

</body>
</html>
